package ua.kharkov.knure.mikhaylov.st4.db.entities;

import java.io.Serializable;
import java.sql.Date;

import ua.kharkov.knure.mikhaylov.st4.db.enums.PaymentState;

/**
 * Payment db entity
 * 
 * @author Saint
 *
 */
public class Payment implements Serializable {

	private static final long serialVersionUID = 2508412056581986847L;
	
	private long id;
	private Account payer;
	private Account reciever;
	private double val;
	private Date paymentDate;
	private PaymentState paymentState;

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public Account getPayer() {
		return payer;
	}

	public void setPayer(Account payer) {
		this.payer = payer;
	}

	public Account getReciever() {
		return reciever;
	}

	public void setReciever(Account reciever) {
		this.reciever = reciever;
	}

	public double getVal() {
		return val;
	}

	public void setVal(double val) {
		this.val = val;
	}

	public Date getPaymentDate() {
		return paymentDate;
	}

	public void setPaymentDate(Date paymentDate) {
		this.paymentDate = paymentDate;
	}

	public PaymentState getPaymentState() {
		return paymentState;
	}

	public void setPaymentState(PaymentState paymentState) {
		this.paymentState = paymentState;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof Payment))
			return false;
		Payment other = (Payment) obj;
		return (id == other.id && payer.equals(other.payer)
				&& reciever.equals(other.reciever)
				&& val == other.val
				&& paymentDate.equals(other.paymentDate) 
				&& paymentState.equals(other.paymentState));
	}
}
